//
//  ChargeNextController.m
//  AntsExpress
//
//  Created by slccper on 16/3/9.
//  Copyright © 2016年 slccper. All rights reserved.
//

#import "ChargeNextController.h"
#import "clsBranch.h"
#import "TaobaoCell.h"
#import "ChargeController.h"
@interface ChargeNextController ()
{
    NSMutableArray *BranchList;
}
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@end

@implementation ChargeNextController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableView.sectionHeaderHeight=40;
    self.tableView.separatorStyle=UITableViewCellSeparatorStyleNone;
    self.tableView.tableFooterView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 40)];
    self.title=@"如何收費";
    // Do any additional setup after loading the view from its nib.
}
-(void)getWebData
{
    [clsOtherFun showLoadingView:@"正在獲取數據..."];
    ants = [[clsAntsService alloc]init];
    ants.delegate=self;
    [ants GetBranchLists:self.ware.WareID action:^(NSDictionary *dic) {
        BranchList = [clsBranch GetDataByArr:[dic objectForKey:@"data"]];
        [clsOtherFun hideLoadingView];
        [self.tableView reloadData];
    }];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return BranchList.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"TaobaoCell";
    
    TaobaoCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"TaobaoCell" owner:self options:nil]lastObject];
        cell.accessoryType = UITableViewCellAccessoryNone;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    clsBranch *branch = [BranchList objectAtIndex:indexPath.section];
    [cell.lbTitle setText:branch.BranchName];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    clsBranch *branch = [BranchList objectAtIndex:indexPath.section];
    ChargeController *charge = [[ChargeController alloc]initWithNibName:@"ChargeController" bundle:nil];
    charge.isBack = YES;
    charge.branch=branch;
    [self.navigationController pushViewController:charge animated:YES];
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return [[UIView alloc]init];
}


@end
